package com.chandra.pos.convertor;

/* @(#) AbstractListConverter.java
 * Copyright 2013 - 2015 QatarAirways Group. All Rights Reserved.
 *
 * This Software is the proprietary information of QR Group
 * Use is subject to License terms.
 * Created by T4671 on 18/03/2015.
 */

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public abstract class AbstractListConverter<T, V> implements ListConverter<T, V> {

    @Override
    public List<V> convertListTo(Collection<T> sourceList) {
        List<V> results = new ArrayList<V>();

        for (T item : sourceList) {
            results.add(convertTo(item));
        }

        return results;
    }

    @Override
    public List<T> convertListFrom(Collection<V> sourceList) {
        List<T> results = new ArrayList<T>();

        for (V item : sourceList) {
            results.add(convertFrom(item));
        }

        return results;
    }

}